package com.example.imagesharing;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import java.util.ArrayList;

import adapter.ZanAdapter;


public class ZanActivity extends AppCompatActivity {
//我的->点赞
    private ArrayList<String> mImageUrls = new ArrayList<>();
    private ArrayList<String> mNames = new ArrayList<>();

    private static final int NUM_COLUMNS = 2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zan);


        initImageBitmaps();
        RecyclerView recyclerView = findViewById(R.id.zan_reclcyerView);
        ZanAdapter collAdapter = new ZanAdapter(this,mNames,mImageUrls);

        StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(NUM_COLUMNS, StaggeredGridLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(manager);
        recyclerView.setAdapter(collAdapter);



    }

    private void initImageBitmaps(){


        mImageUrls.add("https://img2.baidu.com/it/u=1384998556,3952756461&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=501");
        mNames.add("Havasu Falls");

        mImageUrls.add("https://img2.baidu.com/it/u=3906899204,1673385652&fm=253&fmt=auto&app=138&f=JPEG?w=538&h=500");
        mNames.add("Trondheim");

        mImageUrls.add("https://img1.baidu.com/it/u=2124009234,996919229&fm=253&fmt=auto&app=120&f=JPEG?w=640&h=640");
        mNames.add("Portugal");

        mImageUrls.add("https://img0.baidu.com/it/u=1714359884,3913118052&fm=253&fmt=auto&app=138&f=JPEG?w=281&h=500");
        mNames.add("Rocky Mountain National Park");


        mImageUrls.add("https://img1.baidu.com/it/u=353924533,2024263419&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750");
        mNames.add("Mahahual");

        mImageUrls.add("https://img1.baidu.com/it/u=2883742547,404257916&fm=253&fmt=auto&app=138&f=JPEG?w=333&h=500");
        mNames.add("Frozen Lake");


        mImageUrls.add("https://img1.baidu.com/it/u=417111173,1055089806&fm=253&fmt=auto?w=400&h=400");
        mNames.add("White Sands Desert");

        mImageUrls.add("https://img1.baidu.com/it/u=1094973742,2207101179&fm=253&fmt=auto&app=138&f=JPEG?w=440&h=822");
        mNames.add("Austrailia");

        mImageUrls.add("https://img0.baidu.com/it/u=1612636850,3450588167&fm=253&fmt=auto&app=138&f=JPEG?w=160&h=160");
        mNames.add("Washington");


    }
}